import Vue from 'vue';
import Vuex from 'vuex';
Vue.use(Vuex);

// vuex缓存机制
const store = new Vuex.Store({
    state: {
        HOST: 'http://localhost:8888',
        isPlay: false,   // 是否播放中
        url: '',         // 歌曲地址
    },
    getters: {
        isPlay: state => state.isPlay,
        url: state => state.url
    },
    mutations: {
        setIsPlay: (state, isPlay) => { state.isPlay = isPlay },
        setUrl: (state, url) => { state.url = url }
    }
})

export default store;